/*global module:false*/
module.exports = function(grunt) {
  var src_dir = 'src/';
  var src_files = [
    'db.js',
    'draw.js',
    'executor.js',
    'init.js',
    'lang.js'].map(function(x){
      return src_dir + x;
    });
  // Project configuration.
  grunt.initConfig({
    pkg: { // '<json:package.json>',
      "name": "HousePenBox",
      "version": "1.0pre1",
      "description": "HousePenBox",
      "keywords": [],
      "author": {
        "name": "Alexey Michurin <a.michurin@gmail.com>"
      },
      "licenses": [{
        "type": "BSD"
      }],
      "homepage": "http://housepenbox.appspot.com/",
      "readme": ""
    },
    meta: {
      banner: '/* <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
        '<%= grunt.template.today("yyyy-mm-dd") %>\n   ' +
        '<%= pkg.homepage %>\n   ' +
        'Copyright (c) <%= grunt.template.today("yyyy") %> ' +
        '<%= pkg.author.name %>\n   ' +
        'Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */'
    },
    lint: {
      files: ['grunt.js'].concat(src_files)
    },
    test: {
      files: []
    },
    concat: {
      dist: {
        src: ['<banner:meta.banner>'].concat(src_files),
        dest: 'dist/housepenbox.js'
      }
    },
    min: {
      dist: {
        src: ['dist/housepenbox.js'],
        dest: 'dist/housepenbox.min.js'
      }
    },
    watch: {
      files: '<config:lint.files>',
      tasks: 'default'
    },
    jshint: {
      options: {
        curly: true,
        eqeqeq: true,
        immed: true,
        latedef: true,
        newcap: false,
        noarg: true,
        sub: true,
        undef: true,
        boss: true,
        eqnull: true
      },
      globals: {
        // browser
        localStorage: true,
        document: true,
        window: true,
        clearTimeout: true,
        setTimeout: true,
        // jQuery
        $: true,
        jQuery: true,
        // project globals
        commands_map: true,
        // project classes
        draw: true,
        cmd: true,
        parse: true,
        context: true,
        command_executor: true,
        executor: true,
        cmd_gen: true,
        eat_command: true,
        examples_database: true,
        database: true,
        // util
        require: true, // NodeJS
        exports: true, // NodeJS
        L: true, // debug
        console: true
      }
    },
    uglify: {}
  });

  // Default task.
  grunt.registerTask('default', 'lint test concat min');

};
